
*** This do file generates panel C of figure 4 and B7 in the minimum wage precommitment paper

*** BJS event study using the year of first statutory increase as the first treatment year 
*** low-skilled individuals with rich controls, looking at large and small statutory increasers separately

* Drop all states that were originally indexers

set more off
cap log close
clear all

graph drop _all

* Set path * If needed change global path to point to directory where files are stored on your computer
*global path "I:/DataSets5/Duncan/Dropbox/Recent Minimum Wage Changes/2020.12 NBER Update/JOLE Precommittment Replication"
global dtadir "$path/Data"
global tabdir "$path/Tables"
global figdir "$path/Figures"
global estdir "$path/Estimates"
global logdir "$path/Logfiles"

log using "$logdir/BJS-leastskilled-rich-controls-policy-categories-drop-indexers.log", replace

* Load data
use "${path}/Data/ACSEventStudiesData.dta", replace

* Generate sample dummies
gen lowskill = 0
replace lowskill = 1 if dropout == 1 & inrange(age,16,25)

gen young = 0
replace young = 1 if inrange(age,16,21)

* Drop all states that were originally indexers
drop if indexer == 1

* Gen ID for each observation
gen id = _n

est clear
timer clear

set seed 123456

* Least-Skilled Rich Controls
keep if lowskill == 1

* Generate relative periods
gen K = year - legimpyear1

* Manually bin distant periods using wtr function
count if K == 0
gen tau0 = (K== 0)/r(N)
count if K == 1
gen tau1 = (K==1)/r(N)
count if K == 2
gen tau2 = (K==2)/r(N)
count if K == 3
gen tau3 = (K==3)/r(N)
count if K >= 4 & !missing(K)
gen tau4 = (K>=4 & !missing(K))/r(N)

* Large Increasers Least-Skilled Rich Controls
did_imputation employed id year legimpyear1 if indexer == 0 & StatIncreaserSmall == 0 [aw=cmpwgt], wtr(tau0 tau1 tau2 tau3 tau4) controls(HPI lnPersonalIncome D3HPI D3lnPersonalIncome) fe(statefip year age educ) cluster(statefip) pretrends(3) maxit(1000) verbose
estimates store leastskilled_rich_large

* Small Increasers Least-Skilled Rich Controls. Make sure Maine is only included in the large increaser results above and not also the small increaser results
did_imputation employed id year legimpyear1 if StatIncreaserLarge == 0 & statefip != 23 [aw=cmpwgt], wtr(tau0 tau1 tau2 tau3 tau4) controls(HPI lnPersonalIncome D3HPI D3lnPersonalIncome) fe(statefip year age educ) cluster(statefip) pretrends(3) maxit(1000) verbose
estimates store leastskilled_rich_small

event_plot leastskilled_rich_large leastskilled_rich_small, together plottype(scatter) ciplottype(rspike) savecoef stub_lag(tau_tau#) noautolegend perturb(-0.2) ///
	graph_opt(title("Panel C: Low-Skilled with Rich Controls", size(medsmall)) ytitle("", size(small)) xtitle("", size(small)) scheme(s2mono) ///
	xlabel(-3 "-3" -2 "-2" -1 "-1" 0 "0" 1 "1" 2 "2" 3 "3" 4 "4+", labsize(small)) ylabel(-.075 "-.075" -0.05 "-.050" -0.025 "-.025" 0 "0" .025 ".025", labsize(small) gmin gmax) ///
	xline(-0.5, lpattern(dash) lcolor(black)) yline(0, lpattern(solid) lcolor(black)) bgcolor(white) graphregion(color(white)) /// 
	legend(order(1 "Large Increasers" 3 "Small Increasers") region(lstyle(none)) rows(1) size(small) symxsize(small) symysize(small)) name(leastskilled_rich_large_small, replace)) ///
	lag_opt1(color(black) msymbol(circle)) lag_opt2(color(black) msymbol(triangle)) lead_opt(color(black)) lag_ci_opt(color(black black)) lead_ci_opt(color(black black))
	graph save "$figdir/BJS/leastskilled-rich-controls-policy-categories-drop-indexers.gph", replace
	